package com.parkingspace.controller;


import com.parkingspace.service.IParkingInformationService;
import com.parkingspace.util.Constants;
import com.parkingspace.util.ResultVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 车位信息表 前端控制器
 * </p>
 *
 * @author Gapper
 * @since 2021-05-24
 */
@RestController
@RequestMapping("/parking-information")
public class ParkingInformationController {

	@Resource
	private IParkingInformationService iParkingInformationService;

	/**
	 * 录入车牌信息
	 * @param parkingId 车位ID
	 * @return 返回Boolean
	 */
	@PutMapping("/updateById/{parkingId}")
	public ResultVO updateById (@PathVariable("parkingId") Long parkingId) {
		try {
			Boolean aBoolean = iParkingInformationService.updateById(parkingId);
			return new ResultVO(Constants.OPER_SUCCESS,"请求成功!", aBoolean);
		} catch (Exception e) {
			e.printStackTrace();
			return new ResultVO(Constants.OPER_FAILURE,e.getMessage(),Boolean.FALSE);
		}
	}

}

